<?php
function setUserCookie($email, $pass, $id) {
		if(isset($_POST['login']) && $_POST['login']=="Login" || isset($_POST['register']) && $_POST['register']=="Jetzt registrieren") {
			$future = time() * 60;
			setcookie("email", $email, $future);
			setcookie("pass", $pass, $future);
			setcookie("id", $id, $future);
			
		}
}
	
function deleteCookie() {
		$past = time() - 3600;
		setcookie("email", "", $past);
		setcookie("pass", "", $past);
		setcookie("id", "", $past);
		unset($_COOKIE["email"]);
		unset($_COOKIE["pass"]);
		unset($_COOKIE["id"]);
}

function setSessionOwn() {
	if(isset($_POST['login']) && $_POST['login']=="Login" || isset($_POST['register']) && $_POST['register']=="Jetzt registrieren"){
		$email = $_POST['email'];
		$pass = md5($_POST["passwort"]);
		$querry = mysql_query("SELECT id FROM user WHERE email='".$email."'");			
		$tmp = mysql_fetch_assoc($querry);
		$id = $tmp['id'];
		$_SESSION['email']=$email;
		$_SESSION['pass']=$pass;
		$_SESSION['id']=$id;
	}
}

function setCookieOwn() {
	if(isset($_POST['login']) && $_POST['login']=="Login" || isset($_POST['register']) && $_POST['register']=="Jetzt registrieren"){
		$email = $_POST['email'];
		$pass = md5($_POST["passwort"]);
		$querry = mysql_query("SELECT id FROM user WHERE email='".$email."'");			
		$tmp = mysql_fetch_assoc($querry);
		$id = $tmp['id'];
		setUserCookie($email, $pass, $id);
	}
}
?>